HAL Q Functions

Q Initialization and de-initialization functions

group Q_Exported_Functions_Group1

This section provides functions to initialize and de-initialize the logical Q object:

  • Call the function HAL_Q_Init() to initialize the logical Q object and associate its operation information.

  • Call the function HAL_Q_DeInit() to de-initialize the logical Q object and unlink its nodes.

Functions

hal_status_t HAL_Q_Init ( hal_q_t * p_q , const hal_q_desc_ops_t * p_desc_ops )

Initialize the logical Q object and associate its operation information.

Note

The p_desc_ops is a constant provided by HAL PPP modules that support the linked-list feature, titled HAL_PPP_{mode}_DescOps or HAL_PPP_DescOps.

Parameters :
  • p_q – Pointer to a hal_q_t structure that contains Q information.

  • p_desc_ops – Pointer to a hal_q_desc_ops_t structure that contains Q operation information.

Return values :
  • HAL_OK – In the case of a valid initialization.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

void HAL_Q_DeInit ( hal_q_t * p_q )

De-initialize the logical Q object and unlink its node(s).

Parameters :

p_q – Pointer to a hal_q_t structure that contains Q information.

Q node insertion functions

group Q_Exported_Functions_Group2

This section provides functions to insert a new node at any Q position:

Functions

hal_status_t HAL_Q_InsertNode ( hal_q_t * p_q , const void * p_node , void * p_new_node )

Insert a new node after a previous node in a Q.

Parameters :
  • p_q – Pointer to a hal_q_t structure that contains Q information.

  • p_node – Pointer to the node that specifies the insertion position. When null, the new node is placed at the head of Q.

  • p_new_node – Pointer to a new node.

Return values :
  • HAL_OK – In the case of a successful node insertion.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

  • HAL_ERROR – In the case of the p_prev_node not found in the Q.

hal_status_t HAL_Q_InsertNode_Head ( hal_q_t * p_q , void * p_new_node )

Insert a new node at the head of the Q.

Parameters :
  • p_q – Pointer to a hal_q_t structure that contains Q information.

  • p_new_node – Pointer to a new node.

Return values :
  • HAL_OK – In the case of a successful node insertion at the head of the Q.

  • HAL_ERROR – In the case of a node insertion failure.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

hal_status_t HAL_Q_InsertNode_Tail ( hal_q_t * p_q , void * p_new_node )

Insert a new node at the tail of the Q.

Parameters :
  • p_q – Pointer to a hal_q_t structure that contains Q information.

  • p_new_node – Pointer to a new node.

Return values :
  • HAL_OK – In the case of a successful node insertion at the tail of the Q.

  • HAL_ERROR – In the case of a node insertion failure.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

Q node removing functions

group Q_Exported_Functions_Group3

This section provides functions to remove any existing node from a Q:

Functions

hal_status_t HAL_Q_RemoveNode ( hal_q_t * p_q , const void * p_node )

Remove a node from the Q.

Parameters :
  • p_q – Pointer to a hal_q_t structure that contains Q information.

  • p_node – Pointer to the previous node.

Return values :
  • HAL_OK – In the case of a successful node removal.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

  • HAL_ERROR – In the case of a node not found in the Q.

hal_status_t HAL_Q_RemoveNode_Head ( hal_q_t * p_q )

Remove the head node of the Q.

Parameters :

p_q – Pointer to a hal_q_t structure that contains Q information.

Return values :
  • HAL_OK – In the case of a successful head node removal.

  • HAL_ERROR – In the case of a node not found.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

hal_status_t HAL_Q_RemoveNode_Tail ( hal_q_t * p_q )

Remove the tail node of the Q.

Parameters :

p_q – Pointer to a hal_q_t structure that contains Q information.

Return values :
  • HAL_OK – In the case of a successful tail node removal.

  • HAL_ERROR – In the case of a node not found.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

Q node replacing functions

group Q_Exported_Functions_Group4

This section provides functions to replace any existing node in a Q:

Functions

hal_status_t HAL_Q_ReplaceNode ( hal_q_t * p_q , const void * p_old_node , void * p_new_node )

Replace a node in the Q.

Parameters :
  • p_q – Pointer to a hal_q_t structure that contains Q information.

  • p_old_node – Pointer to an old node.

  • p_new_node – Pointer to a new node.

Return values :
  • HAL_OK – In the case of a successful node replacement.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

  • HAL_ERROR – In the case of the old node not found in the Q.

hal_status_t HAL_Q_ReplaceNode_Head ( hal_q_t * p_q , void * p_new_node )

Replace the head node in the Q.

Parameters :
  • p_q – Pointer to a hal_q_t structure that contains Q information.

  • p_new_node – Pointer to a new node.

Return values :
  • HAL_OK – In the case of a successful head node replacement.

  • HAL_ERROR – In the case of the old node not found in the Q.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

hal_status_t HAL_Q_ReplaceNode_Tail ( hal_q_t * p_q , void * p_new_node )

Replace the tail node in the Q.

Parameters :
  • p_q – Pointer to a hal_q_t structure that contains Q information.

  • p_new_node – Pointer to a new node.

Return values :
  • HAL_OK – In the case of a successful tail node replacement.

  • HAL_ERROR – In the case of the old node not found in the Q.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

Q inserting Q functions

group Q_Exported_Functions_Group5

This section provides functions to insert a source Q at any destination Q position:

Functions

hal_status_t HAL_Q_InsertQ ( hal_q_t * p_dest_q , hal_q_t * p_src_q , const void * p_node )

Insert a source Q directly after the previous node in the destination Q.

Parameters :
  • p_dest_q – Pointer to a hal_q_t structure that contains Q information.

  • p_src_q – Pointer to a hal_q_t structure that contains Q information.

  • p_node – Pointer to the previous node. When null, the source Q node(s) are placed at the head of the destination Q.

Return values :
  • HAL_OK – In the case of a successful source Q insertion in the destination Q.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

  • HAL_ERROR – In the case of the p_prev_node not found in the Q.

hal_status_t HAL_Q_InsertQ_Head ( hal_q_t * p_dest_q , hal_q_t * p_src_q )

Insert a source Q at the head of the destination Q.

Parameters :
  • p_dest_q – Pointer to a hal_q_t structure that contains Q information.

  • p_src_q – Pointer to a hal_q_t structure that contains Q information.

Return values :
  • HAL_OK – In the case of a successful source Q insertion at the head of the destination Q.

  • HAL_ERROR – In the case of the source Q not inserted in the destination Q.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

hal_status_t HAL_Q_InsertQ_Tail ( hal_q_t * p_dest_q , hal_q_t * p_src_q )

Insert a source Q at the tail of the destination Q.

Parameters :
  • p_dest_q – Pointer to a hal_q_t structure that contains Q information.

  • p_src_q – Pointer to a hal_q_t structure that contains Q information.

Return values :
  • HAL_OK – In the case of a successful source Q insertion at the tail of the destination Q.

  • HAL_ERROR – In the case of the source Q not inserted in the destination Q.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

Q circularizing Q functions

group Q_Exported_Functions_Group6

This section provides functions to set and clear a circular link to any node in a non-empty Q:

Functions

hal_status_t HAL_Q_SetCircularLinkQ ( hal_q_t * p_q , void * p_node )

Set a circular link to any selected Q node.

Parameters :
  • p_q – Pointer to a hal_q_t structure that contains Q information.

  • p_node – Pointer to the first circular node.

Return values :
  • HAL_OK – In the case of Q circularization.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

  • HAL_ERROR – In case of p_node node not found in the Q.

hal_status_t HAL_Q_SetCircularLinkQ_Head ( hal_q_t * p_q )

Set Q circular mode.

Parameters :

p_q – Pointer to a hal_q_t structure that contains Q information.

Return values :
  • HAL_OK – In the case of Q circularized on the head.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

hal_status_t HAL_Q_SetCircularLinkQ_Tail ( hal_q_t * p_q )

Set Q circular mode.

Parameters :

p_q – Pointer to a hal_q_t structure that contains Q information.

Return values :
  • HAL_OK – In the case of Q circularized on the tail.

  • HAL_INVALID_PARAM – In the case of an invalid parameter.

hal_status_t HAL_Q_ClearCircularLinkQ ( hal_q_t * p_q )

Clear circular mode of the Q.

Parameters :

p_q – Pointer to a hal_q_t structure that contains Q information.

Return values :

HAL_OK – In the case of Q being cleared.